package com.oocl.dataprocess.printer;

import java.util.ArrayList;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import com.oocl.dataprocess.comparator.BirthComparator;
import com.oocl.dataprocess.filter.Impl.FilterRex;
import com.oocl.dataprocess.parser.Impl.ParseTxT;
import com.oocl.dataprocess.pojo.Customer;

public class PrinterText {
	private static FilterRex fRex;
	private static ParseTxT pTXT;
	@BeforeClass
	public static void init(){
		pTXT = new ParseTxT();
		fRex = new FilterRex();
	}
	
	@Test
	public void testPrint(){
		System.out.println("==========================按id排序===========================");
		ArrayList<Customer> customer1 = fRex.filterWrong(pTXT.parseFromTxT("data.txt"));
		Printer.print("id", customer1);
		System.out.println("==========================按birth排序===========================");
		ArrayList<Customer> customer2 = fRex.filterWrong(pTXT.parseFromTxT("data.txt"));
		Printer.print("birth", customer2);
	}
	@Test 
	public void testPrintXML(){
		Printer.printXML(fRex.filterWrong(pTXT.parseFromTxT("data.txt")),new BirthComparator());
	}
	@AfterClass
	public static void after(){
		pTXT = null;
		fRex = null;
	}
}
